/*******************************************************************
 *
 * Copyright (C), 2021-2022, LS, All rights reserved.
 *
 * Author      : 
 * Create Time : 2020-12-14
 * Version     : v0.1
 * Description : 
 *******************************************************************/
#ifndef __WM_H__
#define __WM_H__

/*----------------------------Head file----------------------------*/
#include "stdint.h"
#include "app_display.h"

/*----------------------------macro file---------------------------*/

/*----------------------------type define--------------------------*/
typedef void (*win_excute_cb)(void);

typedef struct{
    uint8_t cur_win;
    uint8_t revert_win;
    win_excute_cb short_press_cb;
    win_excute_cb long_press_cb;
    win_excute_cb double_click_cb;
    win_excute_cb auto_update_4hz_cb;
    win_excute_cb auto_update_2hz_cb;
    win_excute_cb auto_update_1hz_cb;
    uint16_t disp_off_cnt;
    uint16_t backlight_off_cnt;
    uint8_t flash_cnt_down;
}wm_t;

typedef enum {
    NO_WIN = 0,
    FULL_DISP_WIN,

    CNT_DOWN_START_WIN,
    FREE_SKIP_WIN,
    COUNTDOWN_TIME_SKIP_WIN,
    COUNTDOWN_NUM_SKIP_WIN,
    CUMULATIVE_NUM_SKIP_WIN,

    OTA_ING_WIN,
    OTA_DONE_WIN,
    OTA_FAIL_WIN,

    SN_WIN,
    BURN_ING_WIN,
    BURN_DONE_WIN,

    BOARD_TEST_WIN,
    DEV_TEST_PASS_WIN,

}windows_t;

/*----------------------------var define---------------------------*/
extern wm_t wm;

/*-----------------------------------------------------------------*/
extern void wm_info_set(wm_t* info);
extern void wm_set_cur_win(uint8_t cur_win);
extern void wm_set_disp_off_cnt(uint16_t cnt);
extern void wm_set_backlight_off_cnt(uint16_t cnt);
extern void wm_disp_off_and_bl_cnt_reset(void);
extern void wm_charge_bl_off_cnt_reset(void);
extern void wm_disp_off_cnt_reset(void);
extern uint8_t wm_get_cur_win(void);
extern uint8_t wm_get_revert_win(void);
extern void wm_update_handle(void);
extern void wm_set_flash_cnt_down(void);

extern void wm_full_disp(void);
extern void wm_cnt_down_secs_start_disp(void);
extern void wm_free_skip_disp(bool reset);
extern void wm_countdown_time_skip_disp(bool reset);
extern void wm_countdown_num_skip_disp(bool reset);
extern void wm_cumulative_num_skip_disp(bool reset);
extern void wm_batt_charging_disp(void);
extern void wm_board_test_disp(void);
extern void wm_dev_test_disp(void);
extern void wm_batt_low_lock_disp(void);

extern void wm_ota_ing_disp(void);
extern void wm_ota_done_disp(void);
extern void wm_ota_fail_disp(void);

extern void wm_sn_disp(void);
extern void wm_burn_enter_disp(void);
extern void wm_burn_done_disp(void);

extern void ui_revert_last_skip_mode_disp(bool reset);

#endif

